<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>title</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css"/>
    <link rel="stylesheet" type="text/css" href="../css/aui.css"/>
    <link rel="stylesheet" type="text/css" href="../icon/aosen/css/font-awesome.min.css" />
    <style>
    	body,html{
			background:#EEEEEE
    	}
    	.user-msg{
    		width:100%;
    		height:9.5rem;
    		background: -webkit-linear-gradient(#f33d2f, #fb7f4e);
			background: -o-linear-gradient(#f33d2f, #fb7f4e);
			background: -moz-linear-gradient(#f33d2f, #fb7f4e);
			background: linear-gradient(#f33d2f, #fb7f4e);
			display:flex;
			display:-webkit-flex;
			flex-direction: column;
			-webkit-justify-content: center;
    		justify-content: center;
    	}
    	.user-header-box{
    		width:100%;
    		height:5rem;
    		display:flex;
			display:-webkit-flex;
			-webkit-justify-content: center;
    		justify-content: center;
    	}
    	.user-name{
    		width:100%;
    		height:2rem;
    		text-align:center;
    		line-height: 2rem;
    		color:white;
    	}
    	.user-header{
    		width:5rem;
    		height:5rem;
    		border-radius:50%;
    		background:rgba(255,255,255,0.2)
    	}
    	.user-header div{
    		width:4rem;
    		height:4rem;
    		margin:0.5rem auto;
    		border-radius:50%;
    		overflow:hidden;
    		background:white
    	}
    	.user-header div img{
    		width:100%;
    		height:100%;
    		display:block;
    	}
    	.money-manage{
    		width:100%;
    		height:2.5rem;
    		background:white;
    		line-height:2.5rem;

    	}
    	.aui-grid{
    		border-top:1px solid #eee;
    	}
    	#kefu{
    	width: 2.5rem;
    	height: 2.5rem;
    	border-radius: 50%;
    	background: #ff4800;
    	position: absolute;
    	bottom: 3rem;
    	right: 0;
    	touch-action: none;
    	overflow:hidden;
    }
    #kefu img{
    	width:90%;
    	height:80%;
    	display:block;
    	margin: 0 auto;
    	margin-top:0.25rem;
    }
    </style>
</head>
<body>
	<div class="user-msg" onclick="userEdit()">
		<div class="user-header-box">
			<div class="user-header">
				<div>
					<img src="" id="header"/>
				</div>
			</div>
		</div>
		<div class="user-name"><span id="userName"></span><i class="fa fa-edit" style="margin-left: 0.3rem;color: black"></i></div>
	</div>
	<div class="money-manage aui-margin-t-10">
		<i class="fa fa-money" style="margin:0 0.3rem 0 0.8rem;color: #1d7dfd"></i>资金管理
	</div>
	<section class="aui-grid" style="">
  		<div class="aui-row" style="margin-top: 0; font-size: 7vw">
  			<div class="aui-col-xs-4" style="margin:0.5rem 0;padding:0">
	            <span class="" style="color: red" id="money">0.00</span>
	            <div class="aui-grid-label">可用余额</div>
	        </div>
	        <div class="aui-col-xs-4" style="margin:0.5rem 0;padding:0;border-left: 1px solid #eee;border-right: 1px solid #eee" onclick="getMoney()">
	            <i class="fa fa-rmb" style="color: #41c522"></i>
	            <div class="aui-grid-label">提现</div>
	        </div>
	        <div class="aui-col-xs-4" style="margin:0.5rem 0;padding:0" onclick="moneyLog()">
	            <i class="fa fa-book" style="color: #6f9fdf"></i>
	            <div class="aui-grid-label">资金明细</div>
	        </div>
  		</div>
  	</section>
  	<!-- <section class="aui-grid" style="">
  		<div class="aui-row" style="margin-top: 0; font-size: 7vw">
	        <div class="aui-col-xs-4" style="margin:0.5rem 0;padding:0;border-right: 1px solid #eee">
	            <i class="fa fa-laptop" style="color: #f75f40"></i>
	            <div class="aui-grid-label">待处理</div>
	        </div>

  		</div>
  	</section> -->
		<div class="money-manage aui-margin-t-10">
			<i class="fa fa-table" style="margin:0 0.3rem 0 0.8rem;color: #5bc62a"></i>订单管理
		</div>
		<section class="aui-grid" style="border-bottom: 1px solid #eee">
	  		<div class="aui-row" style="margin-top: 0; font-size: 6vw">
	  			<div class="aui-col-xs-3" style="margin:0.5rem 0;padding:0" onclick="orderList(0)">
		            <i class="fa fa-rmb" style="color: #fc5c4e"></i>
		            <div class="aui-grid-label">待付款</div>
		        </div>
		        <div class="aui-col-xs-3" style="margin:0.5rem 0;padding:0;border-left: 1px solid #eee;border-right: 1px solid #eee" onclick="orderList(1)">
		            <i class="fa fa-truck" style="color: #fe942e"></i>
		            <div class="aui-grid-label">待发货</div>
		        </div>
		        <div class="aui-col-xs-3" style="margin:0.5rem 0;padding:0;border-right: 1px solid #eee" onclick="orderList(2)">
		            <i class="fa fa-archive" style="color: #918fe3"></i>
		            <div class="aui-grid-label">待收货</div>
		        </div>
						<div class="aui-col-xs-3" style="margin:0.5rem 0;padding:0" onclick="orderList(4)">
		            <i class="fa fa-angellist" style="color: #5bc62a"></i>
		            <div class="aui-grid-label">交易成功</div>
		        </div>
	  		</div>
	  	</section>
	  	<div class="money-manage aui-margin-t-10">
			<i class="fa fa-table" style="margin:0 0.3rem 0 0.8rem;color: yellow"></i>约好交易单
		</div>
		<section class="aui-grid" style="border-bottom: 1px solid #eee">
	  		<div class="aui-row" style="margin-top: 0; font-size: 6vw">


		        <div class="aui-col-xs-3" style="margin:0.5rem 0;padding:0;border-right: 1px solid #eee" onclick="yuehaoOrderList(0)">
		            <i class="fa fa-user" style="color: #918fe3"></i>
		            <div class="aui-grid-label">买入</div>
		        </div>
						<div class="aui-col-xs-3" style="margin:0.5rem 0;padding:0" onclick="yuehaoOrderList(1)">
		            <i class="fa fa-bank" style="color: #5bc62a"></i>
		            <div class="aui-grid-label">卖出</div>
		        </div>
	  		</div>
	  	</section>
	  	<div id="kefu" onclick="openServicePer()">
	  	<img src="../icon/kefu.png"/>
	  </div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/request.js"></script>
<script type="text/javascript" src="../script/drap.js"></script>
<script type="text/javascript" src="../script/kefu.js"></script>
<script type="text/javascript">
	var userId;
	var userInfo;
	var moneyInfo;
	apiready = function(){
		userId = $api.getStorage('userId');
		api.addEventListener({
		    name: 'reload'
		}, function(ret, err){
				window.location.reload();
		});

		api.setRefreshHeaderInfo({
		    loadingImg: 'widget://image/refresh.png',
		    bgColor: 'rgba(0,0,0,0)',
		    textColor: 'rgb(150,150,150)',
		    textDown: '下拉刷新...',
		    textUp: '松开刷新...'
		}, function(ret, err) {
		    getIntData('YES','YES');

		});
		if(userId){
		getIntData('NO','NO');
	}
	};
	function getIntData(loading,isDown){
		var data = {};
		data['values'] = {};
		data['values']['userId'] =userId;
		requestData('Users/getUserMsg',data,loading,'NO',isDown,_callbackData);
	}
	function _callbackData(ret){
		if(ret.status == 200){
			userInfo = ret.user;
			moneyInfo = ret.money;
			var imgObj = new Image();
			imgObj.src = pictureUrl+ret.user.user_header;
			imgObj.onload = function(){
				$api.attr($api.byId('header'), 'src', pictureUrl+ret.user.user_header);
			}
			imgObj.onerror = function(){
				$api.attr($api.byId('header'), 'src', '../image/defaultHeader.jpg');
			}
			$api.text($api.byId('userName'), ret.user.user_name);
			$api.text($api.byId('money'), ret.money.money);
		}
	}
	function userEdit(){
		api.openWin({
	        name: 'userEdit',
	        url: './win.html',
	        pageParam: {
	            page:'userEdit',
	            title: '个人资料',
	            data:userInfo
	        }
	    });
	}
	function getMoney(){
		if(userInfo.alipay_num == ''||userInfo.alipay_num == undefined||userInfo.alipay_num==null){
			if(userInfo.wx_num == ''||userInfo.wx_num == undefined||userInfo.wx_num==null){
				if(userInfo.bank_num == ''||userInfo.bank_num == undefined||userInfo.bank_num==null){
					alert('您还没有添加任何可收款账户，请到个人中心设置后，下拉刷新此页面再进行提现操作！谢谢配合！');
					return false;
				}
			}
		}
		api.openWin({
	        name: 'getMoney',
	        url: './win.html',
	        pageParam: {
	            page:'getMoney',
	            title: '提现',
	            data:moneyInfo
	        }
	    });
	}
	function moneyLog(){
		api.openWin({
        name: 'moneyLog',
        url: './win.html',
        pageParam: {
            page:'moneyLog',
            title: '资金明细',
        }
    });
	}
	function orderList(index){
		api.openWin({
        name: 'orderList',
        url: './win.html',
        pageParam: {
            page:'orderList',
            title: '订单列表',
            data:index,
        }
    });
	}
	function yuehaoOrderList(index){
		api.openWin({
	        name: 'yuehaoOrderList',
	        url: './win.html',
	        pageParam: {
	            page:'yuehaoOrderList',
	            title: '约好订单列表',
	            data:index,
	        }
	    });
	}
</script>
</html>
